<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.Date" %>
<%@ page import="pojo.User" %>
<!DOCTYPE html>
<html>
<head>
    <title>欢迎页面</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/bookList1.css">
    <style>
        .welcome-container {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background: linear-gradient(135deg, #181c2b 0%, #232946 100%);
        }
        .welcome-card {
            background: rgba(30, 34, 54, 0.95);
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 8px 32px #1e90ff22;
            width: 100%;
            max-width: 600px;
        }
        .welcome-card h1, .welcome-card h2 {
            text-align: center;
            color: #1e90ff;
        }
        .login-time {
            text-align: center;
            color: #b0b3c6;
        }
        .action-buttons {
            text-align: center;
        }
        .btn-primary {
            background: #1e90ff;
            border-color: #1e90ff;
        }
        .btn-primary:hover {
            background: #181c2b;
            border-color: #1e90ff;
        }
    </style>
</head>
<body>
<div class="welcome-container">
    <div class="welcome-card">
        <%
            // 检查用户是否登录
            User user = (User) session.getAttribute("user");
            if(user == null) {
                response.sendRedirect("login.jsp");
                return;
            }
            Date loginTime = (Date) session.getAttribute("loginTime");
        %>
        <h1>欢迎登录图书管理系统</h1>
        <h2>你好, <%= user.getUsername() %>!</h2>
        <p class="login-time">您登录的时间是: <%= loginTime %></p>
        <div class="system-desc">
            <p>本系统支持图书的增删改查、模糊搜索与分页浏览，注册用户可登录体验。</p>
            <p>如有问题请联系管理员。祝你使用愉快！</p>
        </div>
        <div class="action-buttons mt-4">
            <a href="bookList" class="btn btn-primary">进入图书管理</a>
            <a href="logoutServlet" class="btn btn-outline-secondary mt-2">退出登录</a>
        </div>
    </div>
</div>
</body>
</html>